﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Modules_IA_DataBrowse : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        GridView1.DataSourceID = "SqlDataSource3";
    }
    public static DateTime GetTime(string now)
    {
        string timeStamp = now;
        DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
        long lTime = long.Parse(timeStamp + "0000000");
        TimeSpan toNow = new TimeSpan(lTime);
        DateTime dtResult = dtStart.Add(toNow);
        return dtResult;
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            switch (e.Row.Cells[5].Text.Trim())
            {
                case "0":
                    e.Row.Cells[5].Text = "晴天";
                    break;
                case "1":
                    e.Row.Cells[5].Text = "下雨";
                    break;
            }
            e.Row.Cells[6].Text = GetTime(e.Row.Cells[6].Text.Trim()).ToString();
        }
    }
}